def blocks(fobj):
    block = []
    counter = 0
    for line in fobj:
        block.append(line)
        counter += 1
        if counter == 10:
            yield block
            block = []
            counter = 0
    if block:
        yield block

if __name__ == '__main__':
    fobj = open('/tmp/passwd')
    counter = 0
    for lines in blocks(fobj):
        counter += 1
        print(counter, lines)
        print()
    fobj.close()